import { uniqueId } from 'lodash'

/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

export const menuHeader = supplementPath([
  // { path: '/index', title: '首页', icon: 'home' },
  // {
  //   title: '页面',
  //   icon: 'folder-o',
  //   children: [
  //     { path: '/page1', title: '用户管理' },
  //     { path: '/page2', title: '权限管理' },
  //     { path: '/page3', title: '页面 3' }
  //   ]
  // }
])

export const menuAside = supplementPath([
  { path: '/index', title: '首页', icon: 'home' },
  {
    title: '职业规划',
    icon: 'folder-o',
    children: [
      { path: '/careerpublish', title: '写职业规划' },
      { path: '/careermanage', title: '职业规划管理' },
      { path: '/careercomment', title: '职业规划点评' },
      { path: '/careerdrafts', title: '草稿箱' },
      { path: '/careerdeleted', title: '回收站' }
    ]
  },
  {
    title: '简历指导',
    icon: 'folder-o',
    children: [
      { path: '/myresume', title: '上传简历' },
      { path: '/resumemanage', title: '简历管理' },
      { path: '/resumecomments', title: '简历点评' }
    ]
  },
  {
    title: '求职指导',
    icon: 'folder-o',
    children: [
      { path: '/applyjob', title: '求职管理' }
    ]
  },
  {
    title: '消息',
    icon: 'folder-o',
    children: [
      { path: '/message', title: '消息' }
    ]
  },
  {
    title: '设置',
    icon: 'folder-o',
    children: [
      { path: '/configtimeslot', title: '时段/专家' },
      { path: '/configabout', title: '个人设置' }
    ]
  }
])
